]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
[linearView] Zoom out when dragging an item from the dash
authorFlorian Müllner <fmuellner@src.gnome.org>
Sat, 8 May 2010 14:06:28 +0000 (16:06 +0200)
committerFlorian Müllner <fmuellner@src.gnome.org>
Thu, 27 May 2010 10:12:10 +0000 (12:12 +0200)
When dragging windows in linear view, the workspace zooms out to
allow moving the window to other workspaces. Enable the same
behaviour for items dragged from the dash.

https://bugzilla.gnome.org/show_bug.cgi?id=618055

js/ui/appDisplay.js
js/ui/dash.js
js/ui/docDisplay.js
js/ui/genericDisplay.js
js/ui/overview.js
js/ui/placeDisplay.js
js/ui/workspacesView.js

index 3cd2eb3d59f5666618694cc9d7825585abb34c27..deeeb6ff50f7f966b12ee6e5fc43083226bc8658 100644 (file)
@@ -42,17 +42,17 @@ AllAppView.prototype = {
     },
 
     _addApp: function(app) {
-        let App = new AppWellIcon(this._appSystem.get_app(app.get_id()));
-        App.connect('launching', Lang.bind(this, function() {
+        let appIcon = new AppWellIcon(this._appSystem.get_app(app.get_id()));
+        appIcon.connect('launching', Lang.bind(this, function() {
             this.emit('launching');
         }));
-        App._draggable.connect('drag-begin', Lang.bind(this, function() {
+        appIcon._draggable.connect('drag-begin', Lang.bind(this, function() {
             this.emit('drag-begin');
         }));
 
-        this._grid.addItem(App.actor);
+        this._grid.addItem(appIcon.actor);
 
-        this._apps.push(App);
+        this._apps.push(appIcon);
     },
 
     refresh: function(apps) {
@@ -402,6 +402,11 @@ AppWellIcon.prototype = {
         this._draggable.connect('drag-begin', Lang.bind(this,
             function () {
                 this._removeMenuTimeout();
+                Main.overview.beginItemDrag(this);
+            }));
+        this._draggable.connect('drag-end', Lang.bind(this,
+            function () {
+               Main.overview.endItemDrag(this);
             }));
 
         this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
index 9d9cddf153e8d01bd6a2ce3baf296550c981034f..4290fd37866e3c1d4979f4545b34d39c9b38aaf8 100644 (file)
@@ -351,6 +351,14 @@ SearchResult.prototype = {
         this.actor.connect('clicked', Lang.bind(this, this._onResultClicked));
 
         let draggable = DND.makeDraggable(this.actor);
+        draggable.connect('drag-begin',
+                          Lang.bind(this, function() {
+                              Main.overview.beginItemDrag(this);
+                          }));
+        draggable.connect('drag-end',
+                          Lang.bind(this, function() {
+                              Main.overview.endItemDrag(this);
+                          }));
     },
 
     setSelected: function(selected) {
index 7e9de073fc38f0c2884906e83f9f22bd387f2f9f..3925c27fd320f7b7b37c5c6e2a9a5405d0839029 100644 (file)
@@ -287,6 +287,14 @@ DashDocDisplayItem.prototype = {
 
         this.actor._delegate = this;
         let draggable = DND.makeDraggable(this.actor);
+        draggable.connect('drag-begin',
+                          Lang.bind(this, function() {
+                              Main.overview.beginItemDrag(this);
+                          }));
+        draggable.connect('drag-end',
+                          Lang.bind(this, function() {
+                              Main.overview.endItemDrag(this);
+                          }));
     },
 
     getUri: function() {
index 3ab8d0d78cc20a25cc3bed423c944883c9231c36..46f1c96618707665e6c3dce0fd8244d902130f11 100644 (file)
@@ -47,6 +47,14 @@ GenericDisplayItem.prototype = {
                                      }));
 
         let draggable = DND.makeDraggable(this.actor);
+        draggable.connect('drag-begin',
+                          Lang.bind(this, function() {
+                              Main.overview.beginItemDrag(this);
+                          }));
+        draggable.connect('drag-end',
+                          Lang.bind(this, function() {
+                              Main.overview.endItemDrag(this);
+                          }));
 
         this._iconBin = new St.Bin();
         this.actor.add(this._iconBin);
index b2a241dc5c53261781773ae86d0be79e957cca75..377659f8bc121d2250b047027ce43485e0ca2f78 100644 (file)
@@ -376,23 +376,20 @@ Overview.prototype = {
         }));
     },
 
-    //// Draggable target interface ////
-
-    // Closes any active panes if a GenericDisplayItem is being
-    // dragged over the Overview, i.e. as soon as it starts being dragged.
-    // This allows the user to place the item on any workspace.
-    handleDragOver : function(source, actor, x, y, time) {
-        if (source instanceof GenericDisplay.GenericDisplayItem
-            || source instanceof AppDisplay.AppIcon) {
+    //// Public methods ////
+
+    beginItemDrag: function(source) {
+        // Close any active panes if @source is a GenericDisplayItem.
+        // This allows the user to place the item on any workspace.
+        if (source instanceof GenericDisplay.GenericDisplayItem)
             if (this._activeDisplayPane != null)
                 this._activeDisplayPane.close();
-            return true;
-        }
-
-        return false;
+        this.emit('item-drag-begin');
     },
 
-    //// Public methods ////
+    endItemDrag: function(source) {
+        this.emit('item-drag-end');
+    },
 
     // Returns the scale the Overview has when we just start zooming out
     // to overview mode. That is, when just the active workspace is showing.
index 6c54a3cc62aa3a63820318382296c3c1bfbf6b6b..452c8e19de65046949c251e2ae356bb00f2421d2 100644 (file)
@@ -443,6 +443,14 @@ DashPlaceDisplayItem.prototype = {
 
         this.actor._delegate = this;
         this._draggable = DND.makeDraggable(this.actor);
+        this._draggable.connect('drag-begin',
+                                Lang.bind(this, function() {
+                                    Main.overview.beginItemDrag(this);
+                                }));
+        this._draggable.connect('drag-end',
+                                Lang.bind(this, function() {
+                                    Main.overview.endItemDrag(this);
+                                }));
     },
 
     _onClicked: function(b) {
index b4b20586e3ff1d049adf520083715cc7c356d171..8eb74d43b6419e2240b3614ae16e416aa14535f0 100644 (file)
@@ -639,11 +639,15 @@ SingleView.prototype = {
 
         GenericWorkspacesView.prototype._init.call(this, width, height, x, y, workspaces);
 
+        this._itemDragBeginId = Main.overview.connect('item-drag-begin',
+                                                      Lang.bind(this, this._dragBegin));
+        this._itemDragEndId = Main.overview.connect('item-drag-end',
+                                                     Lang.bind(this, this._dragEnd));
         for (let i = 0; i < this._workspaces.length; i++) {
             this._workspaces[i]._windowDragBeginId = this._workspaces[i].connect('window-drag-begin',
-                                                                                 Lang.bind(this, this._onWindowDragBegin));
+                                                                                 Lang.bind(this, this._dragBegin));
             this._workspaces[i]._windowDragEndId = this._workspaces[i].connect('window-drag-end',
-                                                                               Lang.bind(this, this._onWindowDragEnd));
+                                                                               Lang.bind(this, this._dragEnd));
         }
 
         this.actor.add_actor(this._newWorkspaceArea.actor);
@@ -1085,9 +1089,9 @@ SingleView.prototype = {
             for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
                 this.actor.add_actor(this._workspaces[w].actor);
                 this._workspaces[w]._windowDragBeginId = this._workspaces[w].connect('window-drag-begin',
-                                                                                     Lang.bind(this, this._onWindowDragBegin));
+                                                                                     Lang.bind(this, this._dragBegin));
                 this._workspaces[w]._windowDragEndId = this._workspaces[w].connect('window-drag-end',
-                                                                                   Lang.bind(this, this._onWindowDragEnd));
+                                                                                   Lang.bind(this, this._dragEnd));
             }
 
             this._computeWorkspacePositions();
@@ -1117,6 +1121,14 @@ SingleView.prototype = {
             Mainloop.source_remove(this._timeoutId);
             this._timeoutId = 0;
         }
+        if (this._itemDragBeginId > 0) {
+            Main.overview.disconnect(this._itemDragBeginId);
+            this._itemDragBeginId = 0;
+        }
+        if (this._itemDragEndId > 0) {
+            Main.overview.disconnect(this._itemDragEndId);
+            this._itemDragEndId = 0;
+        }
         for (let w = 0; w < this._workspaces.length; w++) {
             if (this._workspaces[w]._windowDragBeginId) {
                 this._workspaces[w].disconnect(this._workspaces[w]._windowDragBeginId);
@@ -1170,7 +1182,7 @@ SingleView.prototype = {
         return false;
     },
 
-    _onWindowDragBegin: function(w, actor) {
+    _dragBegin: function() {
         if (!this._scroll || this._scrolling)
             return;
 
@@ -1242,7 +1254,7 @@ SingleView.prototype = {
         }
     },
 
-    _onWindowDragEnd: function(w, actor) {
+    _dragEnd: function() {
         if (this._timeoutId) {
             Mainloop.source_remove(this._timeoutId);
             this._timeoutId = 0;